- @title = person_title(@person)

- if has_type?(@person)
  - content_for :sub_title do
    = link_to_person_role(@person, only_one: true)

- if flash[:show_verification_link]
  .box.box-warning
    .box-header
      %h3.box-title= t('people.verification_email.heading')
    .box-body
      %p= t('people.verification_email.intro')
      %p= render partial: 'admin_send_verification_button'

- unless @person.visible?
  .callout.callout-warning
    = icon 'fa fa-lock'
    = t('people.this_profile_is_hidden')

- if !@family and @logged_in.admin?(:edit_profiles)
  .callout.callout-warning
    = icon 'fa fa-user'
    = t('people.no_family_for_this_person')

- if @person.updates.pending.any? and @logged_in.can_update?(@person)
  .callout.callout-info
    = icon 'fa fa-clock-o'
    = t('people.updates.pending_callout')

.row.profile
  .col-lg-8.col-sm-6
    .row
      .col-lg-6.col-lg-push-6
        .thumbnail
          = avatar_tag @person, size: 'large', class: 'img-full'
        - if @stream_items.any?
          = render partial: 'details'
      .col-lg-6.col-lg-pull-6
        - if (contact_controls = render(partial: 'contact_controls')).present?
          .page-controls
            = contact_controls
        - if @stream_items.any?
          = timeline(@stream_items) || timeline_none
        - else
          = render partial: 'details'

  .col-lg-4.col-sm-6
    = render 'family_box'

    - if @person.testimony.present?
      .box.box-solid.box-success.testimony
        .box-header
          %h3.box-title
            = link_to testimony_person_path(@person) do
              = icon 'fa fa-comment-o'
              = t('people.testimony.box_heading')
        .box-body
          %p= icon 'fa fa-quote-left'
          %p
            = preserve_breaks(truncate_words(@person.testimony, length: 250))
            - if @person.testimony.size > 250
              = link_to t('people.testimony.view_full'), testimony_person_path(@person), class: 'btn bg-gray btn-xs'
          %p.pull-right{style: 'margin-top: -25px'}= icon 'fa fa-quote-right'
        .box-footer
          = link_to t('people.testimony.find_more'), search_path(testimony: true), class: 'btn bg-gray btn-xs'

    - if @person.albums.any?
      .person-albums
        - @person.albums.order(id: :desc).limit(3).reverse.each do |album|
          = link_to album do
            - if album.cover
              = link_to image_tag(album.cover.photo.url(:tn), alt: t('pictures.click_to_enlarge'), class: 'picture thumbnail'), |
                album, title: t('pictures.click_to_enlarge')
            - else
              = image_tag 'picture.tn.jpg', class: 'picture thumbnail'
        = link_to person_albums_path(@person) do
          .thumbnail
            = icon 'fa fa-camera-retro'

    - if setting(:features, :groups)
      - @groups.each do |group|
        .box{class: group_box_class(group)}
          .box-header
            %h3.box-title
              %i.fa.fa-group
              = link_to group.name, group
          .box-body
            %table.table
              %tr
                %td
                  %i.fa.fa-users
                  = t('people.groups.members')
                %td{style: "width:50px;"}= group.memberships.count
              %tr
                %td
                  %i.fa.fa-comments
                  = t('people.groups.messages')
                %td{style: "width:50px;"}= group.messages.count
      - if @groups.any?
        %p= link_to t('people.groups.see_all'), person_groups_path(@person)
      - if @groups.empty? and me?
        .box
          .box-body
            = link_to groups_path, class: 'btn btn-info' do
              = icon 'fa fa-search'
              = t('people.groups.join.button')
